package com.library_manage_system.view;

import java.util.ArrayList;

import javax.swing.JPanel;

import com.library_manage_system.base.Observer;
import com.library_manage_system.strategy.PanelStrategy;
import com.library_manager_system.Book;

public class BorrowBookPanel implements Observer{
	public static  WindowsMainImpl windowsMainImpl;
	private static BorrowBookPanel uniqueInstance;
	
	public static BorrowBookPanel getInstance(WindowsMainImpl windowsMainImpl){
		if(uniqueInstance== null){
			uniqueInstance = new  BorrowBookPanel(windowsMainImpl);
		}
		return uniqueInstance;
	}
	
	public BorrowBookPanel(WindowsMainImpl windowsMainImpl){
		this.windowsMainImpl = windowsMainImpl;
		windowsMainImpl.registerObserver(this);
		
	}

	public  static PanelStrategy strategy;
	public void SetPanelStrategy(PanelStrategy strategy ){
		this.strategy = strategy;
	}
	
	@Override
	public JPanel update(ArrayList<Book> list,WindowsMainImpl windowsMainImpl) {
		// TODO Auto-generated method stub
		return uniqueInstance.strategy.createPanel(list, windowsMainImpl);
	}
}
